/**
 * @author chauthanhthang
 * @comment run with google API. Can not run with android sdk, add <uses-library android:name="com.google.android.maps" /> into MainFest
 */
package com.example.test.chapter13.lauchingpeeractivity;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

import com.example.test.R;
import com.example.test.app.main.ApplicationMain;

public class LaunchActivity extends Activity {
	private EditText lat;
	private EditText lon;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.lauchingpeeractivity);
		Button btn = (Button) findViewById(R.id.map);
		lat = (EditText) findViewById(R.id.lat);
		lat.setText("10");
		lon = (EditText) findViewById(R.id.lon);
		lon.setText("105");
		btn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				String _lat = lat.getText().toString();
				String _lon = lon.getText().toString();
				Uri uri = Uri.parse("geo:" + _lat + "," + _lon);
				startActivity(new Intent(Intent.ACTION_VIEW, uri));
			}
		});
		Button btn1 = (Button) findViewById(R.id.backpage);
		btn1.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(getApplicationContext(),
						ApplicationMain.class);
				startActivity(intent);
				finish();
			}
		});
	}
}
